#include <iostream>
using namespace std;
class Complex {
public:
    double real;
    double img;

    Complex(double r = 0, double i = 0) : real(r), img(i) {}

    Complex add(const Complex& other) const {
        return Complex(real + other.real, img + other.img);
    }

    Complex subtract(const Complex& other) const {
        return Complex(real - other.real, img - other.img);
    }

    void print() const {
        cout << real << ".0" << (img >= 0? "+" : "-") << img << ".0" <<"i" << endl;
    }
};

int main() {
    Complex c1(3.0, 4.0);
    Complex c2(1.0, 2.0);

    c1.print();
    c2.print();

    Complex sum = c1.add(c2);

    sum.print();

    Complex difference = c1.subtract(c2);

    difference.print();

    return 0;
}
